import request from '/@/utils/request';

// ----- 活动列表 -----
// 列表
export const fetchLotteryList = (data?: object) => {
	return request({
		url: '/raffle/page',
		method: 'post',
		data,
	});
};

// 统计
export const fetchLotteryStatic = (data?: object) => {
	return request({
		url: '/raffle/count',
		method: 'post',
		data,
	});
};

// 创建活动
export const fetchCreateLottery = (data: any) => {
	return request({
		url: 'raffle/create',
		method: 'post',
		data,
	});
};

// 编辑活动
export const fetchUpdateLottery = (data: any) => {
	return request({
		url: 'raffle/update',
		method: 'post',
		data,
	});
};

// 删除
export const fetchDelLottery = (params: any) => {
	return request({
		url: '/raffle/delete',
		method: 'get',
		params,
	});
};

// 详情
export const fetchLotteryDetail = (params: any) => {
	return request({
		url: '/raffle/detail',
		method: 'get',
		params,
	});
};

// 预览
export const fetchQrCode = (data: any) => {
	return request({
		url: '/raffle/qrCode',
		method: 'post',
		data,
	});
};

// 活动数据
export const fetchDataList = (data?: object) => {
	return request({
		url: '/raffle/log/page',
		method: 'post',
		data,
	});
};

// 导出活动数据
export const fetchExportData = (data?: object) => {
	return request({
		url: '/raffle/log/export',
		method: 'post',
		responseType: 'blob',
		data,
	});
};
